package net.lesscoding.shop.controller;

import net.lesscoding.shop.common.Result;
import net.lesscoding.shop.entity.Coupon;
import net.lesscoding.shop.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author eleven
 * @date 2024/6/14 9:43
 * @apiNote
 */
@RestController
@RequestMapping("/coupon")
public class CouponController {

    @Autowired
    private CouponService couponService;
    @GetMapping("/{couponId}")
    public Result<Coupon> getById(@PathVariable("couponId") Long couponId) {
        return Result.success(couponService.getById(couponId));
    }

    @PostMapping("/updateById")
    public Result<Boolean> updateById(@RequestBody Coupon coupon) {
        return Result.success(couponService.updateById(coupon));
    }
}
